/**
 * @file GenConstant.h
 *
 *  @date  17 jan 2012
 *      @author calle olsen
 */

#ifndef GENCONSTANT_H_
#define GENCONSTANT_H_
#include <Helpers/ExpRegistry.h>
#include <AbsSyn/GenExpClasses/ExpressionType.h>
#include <AbsSyn/AbsSyn.h>
#include <AbsSyn/TypeEnum.h>



class IExp;

/**
 * \class GenConstant GenConstant.h <Generator/Exp/GenConstant.h>
 *
 * \brief Class for generating constant values depending on IType
 *
 * This class is used by generators that needs to generate a
 * random constant expression. Primarily used by GenExp
 *
 * @see GenExp
 *
 */

class GenConstant {
public:
	~GenConstant();
	/**
	 * \brief Default constructor
	 *
	 * Creates a Expression of a specific type randomly.
	 * based on the expression registry which contains the available
	 * expressions and there generation methods.
	 *
	 * @see IType
	 *
	 * @param Type of constant to be generated
	 */
	GenConstant(TypeEnum Type,const ExpRegistry& expRegistry);

	/**
	 * \brief Returns a randomly created Expression
	 *
	 * creates and returns a new randomly created expression,
	 * of the type initiated in the constructor.
	 * Its up to the caller to delete the expression.
	 *
	 * @return IExp
	 */
	AbsSyn::IExpPtr genConstant() const;


private:
	const ExpRegistry& m_Registry;
	TypeEnum m_Type;

	//Private methods

};


#endif /* GENCONSTANT_H_ */
